Telegram Group & Telegram Channel
#нововведение

PEP 695 был принят! 🚨

PEP 695

В ближайщее время произойдут значительные изменения в синтаксе тайпваров и дженериков.
Вот как сейчас мы создаём generic type alias:

from typing import TypeAlias

_T = TypeVar("_T")

ListOrSet: TypeAlias = list[_T] | set[_T]

Теперь с утверждением данного пепа, это будет выглядить так:

type ListOrSet[T] = list[T] | set[T]

Кроме того синтаксис использования дженериков в классах также упростили.
Теперь он выглядить так:

class ClassA[T: str]:
def method1(self) -> T:
...


Где T - TypeVar.

Подробнее можно почитать об изменения тут.

Что вы думате по поводу подобных изменений? Считаете ли вы введение "var подобных" объявлений, хорошим вектором развития синтаксиса питона? 🤔



tg-me.com/pythonturboru/402
Create:
Last Update:

#нововведение

PEP 695 был принят! 🚨

PEP 695

В ближайщее время произойдут значительные изменения в синтаксе тайпваров и дженериков.
Вот как сейчас мы создаём generic type alias:

from typing import TypeAlias

_T = TypeVar("_T")

ListOrSet: TypeAlias = list[_T] | set[_T]

Теперь с утверждением данного пепа, это будет выглядить так:

type ListOrSet[T] = list[T] | set[T]

Кроме того синтаксис использования дженериков в классах также упростили.
Теперь он выглядить так:

class ClassA[T: str]:
def method1(self) -> T:
...


Где T - TypeVar.

Подробнее можно почитать об изменения тут.

Что вы думате по поводу подобных изменений? Считаете ли вы введение "var подобных" объявлений, хорошим вектором развития синтаксиса питона? 🤔

BY Python Turbo. Уютное сообщество Python разработчиков.




Share with your friend now:
tg-me.com/pythonturboru/402

View MORE
Open in Telegram


Python Turbo Уютное сообщество Python разработчиков Telegram | DID YOU KNOW?

Date: |

Start with a fresh view of investing strategy. The combination of risks and fads this quarter looks to be topping. That means the future is ready to move in.Likely, there will not be a wholesale shift. Company actions will aim to benefit from economic growth, inflationary pressures and a return of market-determined interest rates. In turn, all of that should drive the stock market and investment returns higher.

What is Telegram Possible Future Strategies?

Cryptoassets enthusiasts use this application for their trade activities, and they may make donations for this cause.If somehow Telegram do run out of money to sustain themselves they will probably introduce some features that will not hinder the rudimentary principle of Telegram but provide users with enhanced and enriched experience. This could be similar to features where characters can be customized in a game which directly do not affect the in-game strategies but add to the experience.

Python Turbo Уютное сообщество Python разработчиков from no


Telegram Python Turbo. Уютное сообщество Python разработчиков.
FROM USA